load("//bazel:macros.bzl", "generated_cc_atom", "select_multi")

cc_library(
    name = "core_srcs",
    deps = [
        ":SkImageEncoder_src",
    ],
)

cc_library(
    name = "jpeg_srcs",
    deps = [
        ":SkJPEGWriteUtility_src",
        ":SkJpegEncoder_src",
    ],
)

cc_library(
    name = "png_srcs",
    deps = [
        ":SkPngEncoder_src",
    ],
)

cc_library(
    name = "webp_srcs",
    deps = [
        ":SkWebpEncoder_src",
    ],
)

cc_library(
    name = "srcs",
    visibility = ["//:__subpackages__"],
    deps = [
        ":core_srcs",
    ] + select_multi(
        {
            "//bazel/common_config_settings:jpeg_encode_codec": [":jpeg_srcs"],
            "//bazel/common_config_settings:png_encode_codec": [":png_srcs"],
            "//bazel/common_config_settings:webp_encode_codec": [":webp_srcs"],
        },
        default = [],
    ),
)

generated_cc_atom(
    name = "SkImageEncoderFns_hdr",
    hdrs = ["SkImageEncoderFns.h"],
    visibility = ["//:__subpackages__"],
    deps = [
        "//include/core:SkColor_hdr",
        "//include/core:SkICC_hdr",
        "//include/core:SkTypes_hdr",
        "//include/private:SkColorData_hdr",
        "//include/third_party/skcms:skcms_hdr",
    ],
)

generated_cc_atom(
    name = "SkImageEncoderPriv_hdr",
    hdrs = ["SkImageEncoderPriv.h"],
    visibility = ["//:__subpackages__"],
    deps = [
        "//include/core:SkImageEncoder_hdr",
        "//include/private:SkImageInfoPriv_hdr",
    ],
)

generated_cc_atom(
    name = "SkImageEncoder_src",
    srcs = ["SkImageEncoder.cpp"],
    visibility = ["//:__subpackages__"],
    deps = [
        ":SkImageEncoderPriv_hdr",
        "//include/core:SkBitmap_hdr",
        "//include/encode:SkJpegEncoder_hdr",
        "//include/encode:SkPngEncoder_hdr",
        "//include/encode:SkWebpEncoder_hdr",
    ],
)

generated_cc_atom(
    name = "SkJPEGWriteUtility_hdr",
    hdrs = ["SkJPEGWriteUtility.h"],
    visibility = ["//:__subpackages__"],
    deps = [
        "//include/core:SkStream_hdr",
        "//src/codec:SkJpegPriv_hdr",
        "//third_party:libjpeg-turbo",
    ],
)

generated_cc_atom(
    name = "SkJPEGWriteUtility_src",
    srcs = ["SkJPEGWriteUtility.cpp"],
    visibility = ["//:__subpackages__"],
    deps = [":SkJPEGWriteUtility_hdr"],
)

generated_cc_atom(
    name = "SkJpegEncoder_src",
    srcs = ["SkJpegEncoder.cpp"],
    visibility = ["//:__subpackages__"],
    deps = [
        ":SkImageEncoderFns_hdr",
        ":SkImageEncoderPriv_hdr",
        ":SkJPEGWriteUtility_hdr",
        "//include/core:SkStream_hdr",
        "//include/encode:SkJpegEncoder_hdr",
        "//include/private:SkColorData_hdr",
        "//include/private:SkImageInfoPriv_hdr",
        "//include/private:SkTemplates_hdr",
        "//src/core:SkMSAN_hdr",
        "//third_party:libjpeg-turbo",
    ],
)

generated_cc_atom(
    name = "SkPngEncoder_src",
    srcs = ["SkPngEncoder.cpp"],
    visibility = ["//:__subpackages__"],
    deps = [
        ":SkImageEncoderFns_hdr",
        ":SkImageEncoderPriv_hdr",
        "//include/core:SkStream_hdr",
        "//include/core:SkString_hdr",
        "//include/encode:SkPngEncoder_hdr",
        "//include/private:SkImageInfoPriv_hdr",
        "//src/codec:SkColorTable_hdr",
        "//src/codec:SkPngPriv_hdr",
        "//src/core:SkMSAN_hdr",
        "//third_party:libpng",
    ],
)

generated_cc_atom(
    name = "SkWebpEncoder_src",
    srcs = ["SkWebpEncoder.cpp"],
    visibility = ["//:__subpackages__"],
    deps = [
        ":SkImageEncoderFns_hdr",
        ":SkImageEncoderPriv_hdr",
        "//include/core:SkBitmap_hdr",
        "//include/core:SkStream_hdr",
        "//include/core:SkUnPreMultiply_hdr",
        "//include/encode:SkWebpEncoder_hdr",
        "//include/private:SkColorData_hdr",
        "//include/private:SkImageInfoPriv_hdr",
        "//include/private:SkTemplates_hdr",
        "//src/utils:SkUTF_hdr",
        "//third_party:libwebp",
    ],
)
